import 'package:json_annotation/json_annotation.dart';

part 'news_today_model.g.dart';

@JsonSerializable()
class NewsTodayModel {
  final String? reason;
  final Result? result;
  @JsonKey(name: 'error_code')
  final int? errorCode;

  const NewsTodayModel({
    this.reason,
    this.result,
    this.errorCode,
  });

  factory NewsTodayModel.fromJson(Map<String, dynamic> json) =>
      _$NewsTodayModelFromJson(json);

  Map<String, dynamic> toJson() => _$NewsTodayModelToJson(this);
}

@JsonSerializable()
class Result {
  final String? stat;
  final List<Data>? data;
  final String? page;
  final String? pageSize;

  const Result({
    this.stat,
    this.data,
    this.page,
    this.pageSize,
  });

  factory Result.fromJson(Map<String, dynamic> json) =>
      _$ResultFromJson(json);

  Map<String, dynamic> toJson() => _$ResultToJson(this);
}

@JsonSerializable()
class Data {
  final String? uniquekey;
  final String? title;
  final String? date;
  final String? category;
  @JsonKey(name: 'author_name')
  final String? authorName;
  final String? url;
  @JsonKey(name: 'thumbnail_pic_s')
  final String? thumbnailPicS;
  @JsonKey(name: 'is_content')
  final String? isContent;

  const Data({
    this.uniquekey,
    this.title,
    this.date,
    this.category,
    this.authorName,
    this.url,
    this.thumbnailPicS,
    this.isContent,
  });

  factory Data.fromJson(Map<String, dynamic> json) =>
      _$DataFromJson(json);

  Map<String, dynamic> toJson() => _$DataToJson(this);
}
